#ifndef _Game_Main_h_
#define _Game_Main_h_
#include<d3d9.h>
#include<d3dx9.h>

#include"GameManager.h"
#include"Mario.h"
#include"Sights.h"
#include"StaticObjects.h"
#include"Enemies.h"
#include"Items.h"
#include"Map.h"
#include"QuadTree.h"
#include"Camara.h"
#include"Object.h"
#include"Text.h"
#include"MushroomMenu.h"
#include"Number.h"
#include"FinishGame.h"
#include"DAudio.h"
class CGameMain:public CGameManager
{
	LPDIRECT3DSURFACE9 Background;
	LPDIRECT3DTEXTURE9 image_for_sights;
	LPDIRECT3DTEXTURE9 image_for_static_objects;
	LPDIRECT3DTEXTURE9 image_for_enemies;
	LPDIRECT3DTEXTURE9 image_for_items;
	LPDIRECT3DSURFACE9 Menu;
	LPDIRECT3DTEXTURE9 image_for_menu;
	LPDIRECT3DTEXTURE9 image_for_coins;
	LPDIRECT3DTEXTURE9 LoadTexture(LPWSTR Filename);
	LPDIRECT3DSURFACE9 LoadSurface(LPWSTR Filename);
	CSound *menuchoose;
	CSound *level1sound;
	CSound *level2sound;
	
public:
	CGameMain(HINSTANCE hInstance, LPWSTR Name, int Mode, int IsFullScreen, int FrameRate);
	~CGameMain();
	LPD3DXSPRITE sprite;
	CMario *Mario;
	CSights **ArraySights;
	CStaticObjects *StaticObjects;
	CEnemies *Enemies;
//	CItems **ArrayItems;
	CMap *map;
	CItems *items;
	CCamara *camara;
	CText *text;
	CMushroomMenu *Mushroom;
	CNumber *number;
	CFinish *FinishGame;
	LIST list;
	//LIST_ENEMIES list_enemies;
	QuadTree *quadtree;
	int nItems;
	int nObjects;
	int nSights;
	bool isMenu;
	bool isIntroduce;
	int index;
	int stage;
	int timeplay;
	int last_time;
	int score;
	int coins;
	//int nEnemies;
protected:
	void EmptyList();
	void EmptyGame();
	void getNoOfObject();
	void getListObject();
	void PauseGame();
	void ResumeGame();
	void RePlay();
	void GameOver();
	void InitGame();
	void MenuStage();
	void Introduce();
	void SaveGame();
	void LoadGame();
	void Level1();
	void Level2();
	virtual void RenderFrame(LPDIRECT3DDEVICE9 d3ddv,int time);
	virtual void LoadResources(LPDIRECT3DDEVICE9 d3ddv);
	virtual void ProcessInput(LPDIRECT3DDEVICE9 d3ddv,int time);
	virtual void OnKeyDown(int KeyCode);
	virtual void OnKeyUp(int KeyCode);
};
#endif